import { find } from "@/services/class";
import { useEffect, useState } from "react";
import Manage from "../index";
import List from "./list";
function Class({classes}:any) {
    // const [classes, setClasses] = useState([]);
    // const show = async () => {
    //     let data = await find();
    //     setClasses(data.rows);
    // };
    // useEffect(() => {
    //     show();
    // }, []);
    return (
        <Manage>
            <div>
                <h2>班级管理</h2>
                <List classes={classes}></List>
            </div>
        </Manage>
    );
}
export async function getServerSideProps(context:any) {
    let res = await fetch("http://localhost:3001/classes");
    let data = await res.json();
    return {
      props: {classes:data.rows}, // will be passed to the page component as props
    }
}
export default Class;
